package main

import (
	"fmt"
	"time"
)

func f(from string) {
	for i := 0; i < 3; i++ {
		fmt.Println(from, ":", i)
	}
}

/*
direct : 0

direct : 1

direct : 2

goroutine : 0

other goroutine : 0

goroutine : 1

goroutine : 2

other goroutine : 1

other goroutine : 2

going

done
*/
func main() {
	f("direct")
	go f("goroutine")
	go func(msg string) {
		fmt.Println(msg)
	}("going")
	go f("other goroutine")

	time.Sleep(time.Second * 2)
	fmt.Println("done")
}
